<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
       xmlns:c="http://java.sun.com/jsf/composite/componentes">  
     
 	<body> 
 	    <ui:composition template="../resources/templates/tempListForm.xhtml">  
 	        
			<!--CABECALHO-->
     	 	<ui:define name="topoList">
     	 		<h:form  id="idFormCabecalho" >                 
				    <table width="100%">
	    		      <tr>
	    		         <td>
	    		         
	    		           	<!--COMPONENTE - TITULO -->
						    <c:compTitulo  formTitulo="Perfis"  
						                   formUrlImg="#{imageBean.imgPerfil}" />  
	    		         </td>
	    		        
	    		         <!-- NOVO -->
	    		         <td align="right">
	    		         
	    		             <!-- NOVO --> 
                            <p:column style="text-align: right;" > 
                                 <p:commandButton action="#{perfilBean.novo}"
                                                   value="#{msg['btn-value-novo']}" 
                                                  styleClass="ui-priority-primary"/>
                            </p:column>  
	    		         </td>
	    		      </tr>
	    		    </table>
    		     </h:form>            
	     	 	
	     	 
    		</ui:define>   
    		
    		<!--CORPO-->
    		<ui:define name="corpoList">
    		    
	       		<!-- GRID DADOS -->
	       		<h:form  id="idFormCorpo" > 
	       		
	       		<!--MESSAGES -->
                <p:growl id="growl" showDetail="true" escape="false" autoUpdate="true" life="#{applicationBean.timeGrowl}"/> 
                      
                  <!-- COMPONENTE - CONFIRM DIALOG -->
				   <c:compConfirmDialog/>
				                        
		            <div class="div-espaco-1"/>  	
		            <!-- FILTROS -->                     
	    		    <h:panelGrid columns="9" cellpadding="2" cellspacing="2" style="padding-left: 12px;" > 
	    								             
		                                         
                          <!-- NOME -->  
                          <h:outputText value="#{msg['page-perfil-list-nome']}" styleClass="data-texto-font" /> 
                          <c:compInputText textValue="#{perfilBean.perfilFilter.nome}" 
                                           textSize="70"
                                           textMaxLength="70"/>
                                              
		               
		                 <!-- BUSCAR  -->
		                 <p:commandButton value="#{msg['btn-value-buscar']}"  icon="ui-icon-search" 
					                      action="#{perfilBean.buscarPorFiltro()}" update="dataTable"/>  
		             	
					</h:panelGrid> 
					
					<div class="div-espaco-1"/>  	 
	 
	       		    <!--DATA TABLE  -->
				    <p:dataTable id="dataTable" var="perfil" widgetVar="filterDataTable"
				                     value="#{perfilBean.listPerfil}"
				                      paginatorPosition="bottom" 
					                  paginator="true" 
					                  styleClass="data-table"
					                  tableStyle="width:auto"
                                      rows="#{applicationBean.recordsPerPage}"  
                                      emptyMessage="#{msg['datatable-msg-semregistro']}"
                                      selectionMode="single" 
                                      paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                      currentPageReportTemplate=" #{msg['datatable-paginador-paginas']} {currentPage} / {totalPages}">
                            
                                      
                            <p:ajax event="rowSelect" listener="#{perfilBean.onRowSelect}" update="dataTable"/>
					        <p:ajax event="rowSelectCheckbox" update="dataTable"/>
                     	    <p:ajax event="rowUnselect" listener="#{perfilBean.onRowSelect}" update="dataTable"/>
                     		<p:ajax event="rowUnselectCheckbox" listener="#{perfilBean.onRowSelect}" update="dataTable"/>
      					                              
					                  
                        <!-- BUSCA - COMPONENTE -->
				        <f:facet name="header"/>  
				        
	                    
                        <!--COLUNA NOME -->
						<p:column  styleClass="data-coluna-texto-font" style="text-align: left;  width: 100%;"
							       filterBy="#{perfil.nome}" filterStyle="display: none;" >
							       <f:facet name="header"><h:outputText value="Nome" /></f:facet>  
							      
							<h:outputText value="#{perfil.nome}" styleClass="data-texto-font" />
						</p:column>
				        
				        <!--COLUNA EXCLUIR-->
				        <p:column headerText=""  styleClass="data-coluna-icone"  style="width: 1%" >
			                 <p:commandButton disabled="#{perfil.fixo}"  
			                                  title="Excluir"  actionListener="#{perfilBean.excluir()}" 
			                                  icon="ui-icon-trash" styleClass="btn-grid" ajax="true"  update="dataTable">  
			                     <f:setPropertyActionListener value="#{perfil}" target="#{perfilBean.perfil}" />  
			                      <p:confirm header="Confirmação" message="#{msg['dlg-msg-body']}"  
					                                   icon="ui-icon-alert" />
			                 </p:commandButton>  
				        </p:column>
	
				    </p:dataTable>
				    
				</h:form>   
    		</ui:define>   
    	</ui:composition> 
  	</body> 
</html>



